<?php 
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
	session_start(); 
}
$lang = $_SESSION['lang'];
if (empty($lang) || $lang == "EN") {
	include "../value/value_en.php";
} else if($lang == "VN") {
	include "../value/value_vn.php";
}
else {
	include "../value/value_kr.php";
}
$mang1=$_SESSION['listCategory'];
include '../operations/connection.php';	
foreach ($mang1 as $value => $giatri){
	$kq = mysql_query("SELECT * from category c where c.id =".$giatri[0]);
	if(mysql_num_rows($kq)==1)
		mysql_query("UPDATE `category` SET `name`='$giatri[1]', `dateStart`='$giatri[2]', `regular`='$giatri[3]',`isDelete`='$giatri[4]' WHERE (`id`='$giatri[0]')");
	else
		mysql_query("INSERT INTO `category` (`id`,`name`, `dateStart`, `regular`, `isDelete`) VALUES ('$giatri[0]','$giatri[1]', '$giatri[2]', '$giatri[3]', '$giatri[4]')");
}
unset($_SESSION['listCategory']);
mysql_close($connection);
?>
